// components/movie-component/movie-component.js

var that;
Component({
   properties: {
      // 这里定义了innerText属性，属性值可以在组件使用时指定
      //observer是属性改变的时候调用的函数，也可在methods中自己定义
      innerText: {
         type: String,
         value: 'default value',
         observer:(newVal,oldVal)=>{
             console.log("newVal = "+newVal);
             console.log("oldVal = "+oldVal);
         },
        myProperty:String,
      }
   },
   data: {
      // 这里是一些组件内部数据
      someData: {}
   },

   created:()=>{
    console.log("自定义组件created");
    that = this;
   },

   attached: ()=>{
    console.log("自定义组件attached");
   },

   ready:()=>{
    console.log("自定义组件ready");
   },

   moved: ()=>{
    console.log("自定义组件moved");
   },
   detached: ()=>{
    console.log("自定义组件detached");
   },

   methods: {
      // 这里是一个自定义方法
      customMethod: function () { 

      },

      onButtonClick:(e)=>{
        const myEventDetail = {
            "id":1,
            "name":"小杰"
        };
        const myEventOption = {
            bubbles:false,
            composted:false,
            capturePhase:false
        };
        this.triggerEvent('myevent',myEventDetail,myEventOption);
      }
   }
})